package com.dmw.dao;

import com.dmw.pojo.Users;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.List;

public interface IUserDaoRepository03 extends Repository <Users ,Integer> {
    @Query(value = "select * from t_user where user_name =?" ,nativeQuery = true)
    List<Users>  findUserName(String userName);

    @Query(value = "select * from t_user where user_name like ? " ,nativeQuery =true)
    List<Users>  findUserNameLike(String userName);

    @Query(value = "select * from t_user where user_name =? and real_name=? " ,nativeQuery = true)
    List<Users>  findUserNameAndRealName(String userName, String realName);

    @Query(value = "update t_user set user_name =?   where user_id =?  " ,nativeQuery = true)
    @Modifying
    void alterUser (String userName, Integer userId) ;
}
